//点击顾客订单
function clickOrders(currentPage,status){
	window.location.href="../orders/toIndentOfInstall.do?currentPage="+currentPage+"&status="+status
}
//保存增加的钱
function saveAddMoney(){
	
	$.post(
			"../orders/saveAddMoneyByIdAndMoney.do",
			$("#biaogeFrom").serialize(),
			function(data){
				if($.type(data)=="number"){
					success("测量费用增加成功!!");
					setTimeout(myfresh,2000);
				}
			},
			"json"
	);
	
}
//中止该订单
function toStopIndent(indentId){
	$.post(
			"../orders/toStopOrStartIndent.do",
			{
				indentId:indentId,
				status:6
			},
			function(data){
				if(data==1){
					success("中止该订单成功!");
					setTimeout(myfresh,2000);
				}
			},
			"json"
	);
}
//开启该订单
function toStartIndent(indentId){
	$.post(
			"../orders/toStopOrStartIndent.do",
			{
				indentId:indentId,
				status:0
			},
			function(data){
				if(data==1){
					success("取消中止该订单成功!");
					setTimeout(myfresh,2000);
				}
			},
			"json"
	);
	
}


//到增加钱的页面
function toAddMoney(indentId){

	$(".hiddenClass").val(indentId);
	$.post(
			"../orders/getAddMoneyByIndentId.do",
			{indentId:indentId},
			function(data){
				$("#orderDetailDiv").find("input .spinner-input").each(function(i,input){
					$(this).val(data.addPrice);
				})
			},
			"json"
	);
}
//操作成功之后提示
function success(text){
	  $("#alerts").html("<div  style='text-align: center; display:no;' class='alert alert-success alert-dismissable'><strong>"+text+"</strong></div>");
	  $("#menus").click();
 
}
//操作失败之后提示

function fail(text){
	  $("#alerts").html("<div  style='text-align: center; display:no;' class='alert alert-success alert-dismissable'><strong>"+text+"</strong></div>");
	  $("#menus").click();

}
function myfresh(){
	window.location.href=window.location.href;
}
//根据订单号获取该接单工人的详细信息
function toAcceptIndentWorker(indentId){
	$.post(
		"../orders/getWorkerByIndentId.do",
		{indentId:indentId},
		function(data){
			makeWorkerData(data);
		},
		"json"
	);
}
//工人信息js
function makeWorkerData(worker){
	var rootDiv=$("#orderDetailDiv");
	rootDiv.empty();
	rootDiv.append('<label>姓名：</label>'+worker.name+'<br>');
	rootDiv.append('<label>头像：</label>');
	rootDiv.append('<div><img alt="" src="http://oeilufnx2.bkt.clouddn.com/'+worker.headImg+'?imageView2/1/w/200/h/200"></div><br>');
	rootDiv.append('<label>手机：</label>'+worker.phone+'<br>');
	rootDiv.append('<label>工作区域：</label>'+worker.workerSpace+'<br>');
	return rootDiv;
}

